package com.yunxiang.controller;

import com.alibaba.fastjson.JSONObject;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.yunxiang.plugin.SqlManager;
import com.yunxiang.service.CarService;

public class CarController extends Controller {

	private CarService carService = new CarService();
	/**
	 * 获取车辆信息，包括车牌号，二维码
	 */
	public void getCarInfo(){
		String openId = getSessionAttr("openId");
		Record car = carService.getCarInfo(openId);
		JSONObject result = new JSONObject();
		result.put("code", 0);
		result.put("message", "success");
		result.put("car_num", car.get("CAR_NUM"));
		result.put("qrcde_url", car.get("QRCDE_URL"));
		renderJson(result.toString());
	}
}
